package com.xuecheng.manage_course.controller;

import com.xuecheng.api.course.CategoryControllerApi;
import com.xuecheng.framework.domain.course.ext.CategoryNode;
import com.xuecheng.framework.domain.course.response.CategoryResponse;
import com.xuecheng.framework.model.response.CommonCode;
import com.xuecheng.manage_course.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/category")
public class CategoryController implements CategoryControllerApi {
    @Autowired
    CategoryService categoryService;
    @Override
    @GetMapping("/list")
    public CategoryResponse findList() {
        List<CategoryNode> categoryNodes = categoryService.selectCategoryList();
        return new CategoryResponse(CommonCode.SUCCESS,categoryNodes);
    }
}
